<?php
/***
 * admin interface
 * for modifying forums layout
 *
 **/

require_once 'config.php';

switch( $_REQUEST['type'] ) {
  case 'FORUM':
    handleForum(); break;
  case 'USER':
    handleUser(); break;
  default: break;
}

function handleForum() {
  require_once 'db/get/forum.php';

  // list all forums and drop down boxes
  $start = (int)intval($_REQUEST['start']);
  $inc = ((int)$_REQUEST['inc'] > 0) ? (int)intval($_REQUEST['inc']) : default_increment();
  
  // XXX error check fora
  $fora = getFora( null, $start, $inc );
  
  require_once 'tpl/use/EditingFora.php';
  skin_EditingFora( $fora );

  $fora = NULL;

}

function handleUser() {
  require_once 'db/get/user.php';

  if (isset($_REQUEST['uid'])) {
    $uid = (int)intval($_REQUEST['uid']);

    $user = getUser( $uid );
    $permArr = explode( ',', getPerms( $uid ) );

    require 'tpl/use/EditingUser.php';
    skin_EditingUser( $user, $permArr );
  } else {
    // requires referrals before it'll work
    //tplFindUserByName();
  }

}

?>
